package br.edu.sistemaacademico.builder.impl;


import br.edu.sistemaacademico.builder.SQLBuilder;

public class DeleteSQLBuilder extends SQLBuilder{

	
	public DeleteSQLBuilder() {
		sql = new StringBuilder("delete from ");
	}

	@Override
	public void buildColunas() {
		StringBuilder sb = new StringBuilder();

		//for (int ind = 0; ind < colunas.size(); ind++) {
			sb.append(colunas.get(0));
			sb.append(" = ");
			//if(colunas.get(ind).getClass().getSimpleName().toLowerCase().contentEquals("id"))
			if (valores.get(0).getClass().getName().equalsIgnoreCase(
					"Java.Lang.Double")
					|| valores.get(0).getClass().getName().equalsIgnoreCase(
							"Java.Lang.Integer")
					|| valores.get(0).getClass().getName().equalsIgnoreCase(
							"Java.Lang.Long")
					|| valores.get(0).getClass().getName().equalsIgnoreCase(
							"Java.Lang.Float")) {
				sb.append(valores.get(0).toString());
			} else {
				sb.append("'").append(valores.get(0).toString()).append("'");
			}
			//if (ind < (colunas.size() - 1))
			//	sb.append(" and ");
		//}
		sql.append(sb);
	}

	@Override
	public void buildCondicao() {
	}

	@Override
	public void buildNomeTabela() {
		sql.append(nomeTabela).append(" where ");
		//sql.append(condicao);
	}

	@Override
	public void buildValores() {		
	}

}
